<template>
<div :class="$style.container">
   <x-button type="default" @click.native="quit">退出登录</x-button>
</div>
</template>

<script>
import { XButton } from 'vux'
import http from '../../../APIService/http'
export default {
  components: {
    XButton
  },
  methods: {
    async quit () {
      try {
        await http.post(`/quit`)
        this.$Cookie.removeToken()
        this.$router.push({
          path: '/'
        })
      } catch (err) {
        console.log('quit fail:', err)
      }
    }
  }
}
</script>

<style lang='less' module>
.container {
  background: #f4f4f4;
  padding: 50px 10px;
  button {
    color:#fff;
    background: #e36049;
  }
}

</style>